package com.ruihu.admin.module.system.user.constant;

import com.ruihu.admin.common.domain.BaseEnum;

import java.util.Objects;

public enum UserTypeEnum implements BaseEnum {

    SUPER_ADMIN(0, "超级管理员"),

    LOCAL_ADMIN(1, "局部管理员"),

    NORMAL_USER(2, "普通用户");

    private Integer value;

    private String desc;

    UserTypeEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }
    public static UserTypeEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (UserTypeEnum userTypeEnum : UserTypeEnum.values()) {
            if (Objects.equals(userTypeEnum.getValue(), code)) {
                return userTypeEnum;
            }
        }
        return null;
    }
    @Override
    public Integer getValue() {
        return value;
    }

    @Override
    public String getDesc() {
        return desc;
    }
}
